using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableExpeditionLevelDao:DaoBase<TableExpeditionLevel>
    {
        public override void AddPrimaryIndex(TableExpeditionLevel model)
        {
            cachePrimary[model.level.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableExpeditionLevel.txt";
        }

        protected override TableExpeditionLevel ParseRowData(string[] rowData)
        {
            TableExpeditionLevel data = new TableExpeditionLevel();
			data.level = rowData [0];
			data.nextLevel = rowData [1];

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.exp = 0;
            }
            else
            {
                data.exp = int.Parse(rowData[2]);
            }

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.expPerHour = 0;
            }
            else
            {
                data.expPerHour = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.maxHeroNum = 0;
            }
            else
            {
                data.maxHeroNum = int.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.difficulty = 0;
            }
            else
            {
                data.difficulty = int.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.maxMissionNum = 0;
            }
            else
            {
                data.maxMissionNum = int.Parse(rowData[6]);
            }

            return data;
        }



    }

}
